package com.purchase.ml.service.sys;

import com.baomidou.mybatisplus.extension.service.IService;
import com.purchase.ml.bean.page.Page;
import com.purchase.ml.bean.req.mail.MailDto;
import com.purchase.ml.bean.req.mail.RePwdDto;
import com.purchase.ml.bean.req.sys.*;
import com.purchase.ml.bean.res.sys.SysRes;
import com.purchase.ml.entity.acc.SysUser;
import com.purchase.ml.entity.sys.SysPermission;

import java.util.List;

/**
* <p>
    *  服务类
    * </p>
*
* @author kyyang
* Created 2021-01-05
*/
    public interface SysUserService extends IService<SysUser> {

    boolean refreshTokenIsValid(String oldToken);

    String loginForToken(SysUser user);

    SysUser findByAccount(String userName);

    SysUser getById(Long userId);

    int save(SysUserDto sysUserDto);
    Page<SysRes> selectAccByPage(SysUserQueryDto accUserQueryDto);

    int editInfo(SysUserEditDto sysUserEditDto);

    int editResetpwd(SysUser sysUser);

    int editPwd(SysUser byAccount, SysUserEditPwdDto sysUserEditPwdDto);

    void logout();

    /**
     * @description: 获取当前用户权限
     * @author kyyang
     * @date 2021/1/21 15:09
     * @version 1.0
     */
    List<SysPermission> accountPermissionsQuery(SysPermissionsDto sysPermissionsDto);

    /**
     * @description: 获取当前用户菜单
     * @author kyyang
     * @date 2021/1/21 19:09
     * @version 1.0
     */
    List<SysPermission> accountMenuQuery();

    /**
     * 通过邮箱查找用户
     * @param email
     * @return
     */
    SysUser getUserByEmail(String email);

    /**
     * 发送重置密码的邮件
     * @param dto
     */
    Boolean handleResetPwd(MailDto dto);

    /**
     * 验证重置码
     * @param dto
     */
    Boolean verifyRepwdCode(RePwdDto dto);
}
